Dropdown List Menu that shows nodes and sub nodes [SOLVED]
I want to create a dropdown list that acts as a menu and shows nodes and sub nodes. For example I currently have nodes as follows:
Test Section 1
-Sub section 1
-Sub section 1
-Sub section 1
Test Section 2
-Sub section A
-Sub section B
I want the dropdown menu to look the same as above and I currently have the following code which works but it just shows "Test Section 1" and "Test Section 2", so all I want to know is how it then lists the child nodes below those sections as shown above with links to the pages. Here is what I have so far:
I was hoping it was going to be fairly straight forward because I have been reading other posts where people want to get Pages and Sub Pages listed, this is similar but I just want them listed in the dropdown menu instead of on the page or in a normal menu and I'm not sure what code to use or how to arrange it to do so.
The difference is the // in this xpath which will look for all nodes no matter how many children deep it is, however if you have child nodes underneath Sub Section 1 for example it will alos list those.
So you could then modify the xPath again to list all child nodes with a particular match for example a specific documentType alias.
Thank you for your help, I managed to get this working the way I wanted with the following code, sorry I should have updated this post but I completely forgot about it, the current issue I am having is in this post http://forum.umbraco.org/yafpostsm44708Next-and-previous-links-to-Pagesnodes-on-same-level.aspx#44708 if you are able to offer any advice.
This is the XSLT that I used for my dropdown menu:
Dropdown List Menu that shows nodes and sub nodes [SOLVED]
I want to create a dropdown list that acts as a menu and shows nodes and sub nodes. For example I currently have nodes as follows:
Test Section 1
-Sub section 1
-Sub section 1
-Sub section 1
Test Section 2
-Sub section A
-Sub section B
I want the dropdown menu to look the same as above and I currently have the following code which works but it just shows "Test Section 1" and "Test Section 2", so all I want to know is how it then lists the child nodes below those sections as shown above with links to the pages. Here is what I have so far:
[code]
[/code]
Anybody got any suggestions on this one?
I was hoping it was going to be fairly straight forward because I have been reading other posts where people want to get Pages and Sub Pages listed, this is similar but I just want them listed in the dropdown menu instead of on the page or in a normal menu and I'm not sure what code to use or how to arrange it to do so.
Hi,
You might get help from this post.
http://forum.umbraco.org/yafpostst8993List-entire-structure-from-changeable-source.aspx
Essentially, you are creating "just another sitemap", packaged in a different HTML markup than usual.
Brgds.
Anders
Hi Tony your Xpath is specifically saying get only the first level of children underneath the Source parameter.
You can ammend your Xpath to this
[code]
umbraco.library:GetXmlNodeById($source)//node [string(data [@alias='umbracoNaviHide']) != '1']
[/code]
The difference is the // in this xpath which will look for all nodes no matter how many children deep it is, however if you have child nodes underneath Sub Section 1 for example it will alos list those.
So you could then modify the xPath again to list all child nodes with a particular match for example a specific documentType alias.
[code]
umbraco.library:GetXmlNodeById($source)//node [string(data [@alias='umbracoNaviHide']) != '1' and @nodeTypeAlias = 'yourNodeTypeAlias']
[/code]
I hope this helps you out.
If you need any more help let me know.
Warren
Hi Warren,
Thank you for your help, I managed to get this working the way I wanted with the following code, sorry I should have updated this post but I completely forgot about it, the current issue I am having is in this post http://forum.umbraco.org/yafpostsm44708Next-and-previous-links-to-Pagesnodes-on-same-level.aspx#44708 if you are able to offer any advice.
This is the XSLT that I used for my dropdown menu:
[code]
[/code]
OK glad you sorted it.
Can you edit your recent post so you can update the forum post title to append [SOLVED] to it. SO people can see find threads that are solved easily.
Thanks,
Warren
is working on a reply...